<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:87:"D:\wwwroot\fangcms\fangcms_city_add\public/../application/mobile\view\loupan\index.html";i:1493802883;s:88:"D:\wwwroot\fangcms\fangcms_city_add\public/../application/mobile\view\public\layout.html";i:1493803137;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title><?php echo $seo['title']; ?></title>
    <meta name="Keywords" content="<?php echo $seo['keys']; ?>">
    <meta name="Description" content="<?php echo $seo['desc']; ?>">
    <link rel="stylesheet" href="__CSS__/amazeui.min.css"/>
    <link type="text/css" rel="stylesheet"  href="__CSS__/main.css"/>
    <link rel="stylesheet" href="__CSS__/mobile.css">
    <script src="__PUBLIC__/js/jquery.min.js"></script>
    <script>
        var page = 1,flag  = true,params =  {page: page};
    </script>
</head>
<body>

<header data-am-widget="header" class="am-header am-header-default">
    <div class="am-header-left am-header-nav">
        <a href="javascript:history.back();" class="">
            <i class="am-header-icon am-icon-chevron-left"></i>
        </a>
    </div>
    <h1 class="am-header-title">
        <?php if(isset($info)): ?><?php echo $info['title']; else: ?><?php echo $title; endif; ?>
    </h1>
    <div class="am-header-right am-header-nav">
        <a href="<?php echo url('Index/index'); ?>" class="">
            <i class="am-header-icon am-icon-home"></i>
        </a>
    </div>
</header>


<script src="__JS__/amazeui.min.js"></script>
<div class="fang-main">
    <div class="am-input-group">
      <input type="text" class="am-form-field" id="keyword" placeholder="填写楼盘关键词">
      <span class="am-input-group-btn">
        <button class="am-btn am-btn-default" type="button" id="search">搜索</button>
      </span>
    </div>
    <ul class="am-avg-sm-4 fang-margin-t">
        <li>
            <select data-am-selected="{maxHeight: 300}" id="area">
                <option value="0">区域</option>
                <?php if(is_array($area) || $area instanceof \think\Collection || $area instanceof \think\Paginator): $i = 0; $__LIST__ = $area;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): $mod = ($i % 2 );++$i;?>
                <option value="<?php echo $val['id']; ?>"><?php echo $val['name']; ?></option>
                <?php endforeach; endif; else: echo "" ;endif; ?>
            </select>
        </li>
        <li>
            <select data-am-selected id="type">
                <option value="0">类型</option>
                <?php if(is_array($type) || $type instanceof \think\Collection || $type instanceof \think\Paginator): $i = 0; $__LIST__ = $type;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                <option value="<?php echo $vo['id']; ?>"><?php echo $vo['name']; ?></option>
                <?php endforeach; endif; else: echo "" ;endif; ?>
            </select>
        </li>
        <li>
            <select data-am-selected id="room">
                <option value="0">户型</option>
                <?php if(is_array($room) || $room instanceof \think\Collection || $room instanceof \think\Paginator): $i = 0; $__LIST__ = $room;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                <option value="<?php echo $vo['id']; ?>"><?php echo $vo['name']; ?></option>
                <?php endforeach; endif; else: echo "" ;endif; ?>
            </select>
        </li>
        <li>
            <select data-am-selected id="price">
                <option value="0">价格</option>
                <?php if(is_array($price) || $price instanceof \think\Collection || $price instanceof \think\Paginator): $i = 0; $__LIST__ = $price;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                <option value="<?php echo $key; ?>"><?php echo $vo['name']; ?></option>
                <?php endforeach; endif; else: echo "" ;endif; ?>
            </select>
        </li>
    </ul>

</div>
<div class="fang-box fang-margin-t">
    <div class="lists-news-pic">
        <ul class="am-list" id="lists" data-uri="<?php echo url('Loupan/getAjaxLists'); ?>" data-total="<?php echo $totalpage; ?>">
            <?php if(is_array($lists) || $lists instanceof \think\Collection || $lists instanceof \think\Paginator): $i = 0; $__LIST__ = $lists;if( count($__LIST__)==0 ) : echo "<li>暂无数据</li>" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
            <li>
                <a href="<?php echo url('Loupan/detail',['id'=>$vo['id']]); ?>" title="<?php echo $vo['title']; ?>" class="img"><img src="<?php echo $vo['img']; ?>" onerror="this.src='__PUBLIC__/images/nopic.jpg'" alt="<?php echo $vo['title']; ?>"></a>
                <dl>
                    <dt><a href="<?php echo url('Loupan/detail',['id'=>$vo['id']]); ?>" title="<?php echo $vo['title']; ?>"><?php echo $vo['title']; ?></a></dt>
                    <dd class="price"><span><?php echo $vo['average_price']; ?>元/m<sup>2</sup></span><?php echo $vo['city_name']; ?><?php echo $vo['area_name']; ?></dd>
                    <dd>地址:<?php echo $vo['address']; ?></dd>
                </dl>
            </li>
            <?php endforeach; endif; else: echo "<li>暂无数据</li>" ;endif; ?>
        </ul>
    </div>
</div>
<p id="loading-alt" class="am-hide">数据加载完成</p>
<script type="text/html" id="template">
    {{# for(var i = 0, len = d.length; i < len; i++){ }}
    <li>
        <a href="{{d[i].url}}" title="{{d[i].url}}" class="img"><img src="{{d[i].img}}" onerror="this.src='__PUBLIC__/images/nopic.jpg'" alt="{{d[i].title}}"></a>
        <dl>
            <dt><a href="{{d[i].url}}" title="{{d[i].title}}">{{d[i].title}}</a></dt>
            <dd class="price"><span>{{d[i].price}}元/m<sup>2</sup></span>{{d[i].city_name}}{{d[i].area_name}}</dd>
            <dd>地址:{{d[i].address}}</dd>
        </dl>
    </li>
    {{# } }}
</script>
<script>
    $(function(){
       $('#area,#type,#room,#price').bind('change',function(){
           $('#lists').html('');
          getVal(1);
          getData();
       });
        $('#search').bind('click',function(){
           var keyword = $('#keyword').val();
            if(keyword.length == 0){
                alert('请填写关键词');
                return false;
            }
            params.area = 0;
            params.type = 0;
            params.room = 0;
            params.price = 0;
            params.page  = 1;
            params.keyword = keyword;
            $('#lists').html('');
            getData();
        });
    });
    getVal(2);
    function getVal(page){
        var area=$('#area').val(),type = $('#type').val(),room = $('#room').val(),
                price = $('#price').val();
        params.area = area;
        params.type = type;
        params.room = room;
        params.price = price;
        params.page  = page;
    }
</script>

<footer data-am-widget="footer" class="am-footer am-footer-default" data-am-footer="{  }">
    <div class="am-footer-switch"><?php $n=0; if(is_array($menu) || $menu instanceof \think\Collection || $menu instanceof \think\Paginator): $i = 0; $__LIST__ = $menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;if($vo['pos'] == 2): $n++; if(!(empty($vo['alias']) || (($vo['alias'] instanceof \think\Collection || $vo['alias'] instanceof \think\Paginator ) && $vo['alias']->isEmpty()))): $url=url($vo['model'].'/detail',['cate'=>$vo['alias']]); else: $url=url($vo['model'].'/index'); endif; if($n > 1): ?><span class="am-footer-divider"> | </span><?php endif; ?><a class="am-footer-desktop" href="<?php echo $url; ?>"><?php echo $vo['title']; ?></a>
        <?php endif; endforeach; endif; else: echo "" ;endif; ?>

    </div>
    <div class="am-footer-miscs ">

        <p>&copy;<?php echo date('Y'); ?>版权所有 <?php echo $site['title']; ?></p>
        <p>客服电话：<?php echo $site['telphone']; ?></p>
    </div>
    <div class="fang-footer-bar">
        <ul class="am-avg-sm-4">
            <li><a href="<?php echo url('Index/index'); ?>" <?php if($controller == "index"): ?>class="on"<?php endif; ?>><i class="am-icon-home am-icon-sm"></i><p>首页</p></a></li>
            <li><a href="<?php echo url('Loupan/index'); ?>" <?php if($controller == "loupan"): ?>class="on"<?php endif; ?>><i class="am-icon-building am-icon-sm"></i><p>新房</p></a></li>
            <li><a href="<?php echo url('Second/index'); ?>" <?php if($controller == "second"): ?>class="on"<?php endif; ?>><i class="am-icon-institution am-icon-sm"></i><p>二手</p></a></li>
            <li><a href="<?php echo url('user.index/index'); ?>"><i class="am-icon-user am-icon-sm"></i><p>我的</p></a></li>
        </ul>
    </div>
</footer>
<?php echo $site['mobileJs']; if(isset($ajaxdata)): ?>
<div id="loadingToast" class="am-hide">
    <div class="ylj-mask"></div>
    <div class="ylj-toast">
        <i class="ylj-loading weui-icon_toast"></i>
        <p class="ylj-toast__content">数据加载中</p>
    </div>
</div>
<script src="__PUBLIC__/js/layer/laytpl.js"></script>
<script>
    $(function(){
        $(window).scroll(function(){
            if(($(window).scrollTop() + $(window).height() > $(document).height()-10) && flag){
                var totalpage = $("#lists").data('total');
                if(totalpage > 1 && totalpage >= page){
                    $("#loadingToast").removeClass('am-hide');
                    getData();
                }else{
                    $("#loading-alt").removeClass('am-hide');
                    flag = false;
                }
            }
        });
    });
    function getData(){
        var url =  $("#lists").data('uri');
        $.get(url,params,function(data){
            $("#loadingToast").addClass('am-hide');
            if(data.status == 1){
                if(data.data){
                    var gettpl = document.getElementById('template').innerHTML;
                    laytpl(gettpl).render(data.data, function(html){
                        $('#lists').append(html);
                    });
                }else{
                    $('#lists').html('<li>暂无数据</li>');
                }

            }else{
                $("#loading-alt").removeClass('am-hide');
                flag = false;
            }
        });
        page++;
    }
</script>
<?php endif; ?>
</body>
</html>